package com.iwinding.ladygg.ui.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;

import com.hyphenate.easeui.adapter.EaseContactAdapter;
import com.hyphenate.easeui.domain.EaseUser;
import com.iwinding.ladygg.R;

import java.util.List;

/**
 * Created by hezhiyong on 2017/4/20.
 */

public class PromptContactAdapter extends EaseContactAdapter {


    private OnUserEvent onUserEvent;

    public void setOnUserEvent(OnUserEvent onUserEvent){
        this.onUserEvent = onUserEvent;
    }

    public PromptContactAdapter(Context context, int resource, List<EaseUser> objects) {
        super(context, resource, objects);
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = super.getView(position,convertView,parent);
        final CheckBox checkBox = (CheckBox)convertView.findViewById(R.id.checkbox1);
        EaseUser user = getItem(position);
        checkBox.setChecked(onUserEvent.isBePrompt(user.getUsername()));
        return convertView;
    }

    public interface OnUserEvent{
        void updatePromptContact();
        void initPromptContact();
        boolean isBePrompt(String userId);
    }
    
}
